/**
* Copyright (c) 2022 - present TinyVue Authors.
* Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
*
* Use of this source code is governed by an MIT-style license.
*
* THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
* BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
* A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
*
*/

@import '../mixins/tip.less';
@import '../custom.less';
@import './vars.less';

@slider-prefix-cls: ~'@{css-prefix}mobile-slider';

.@{slider-prefix-cls} {
  position: relative;
  height: var(--ti-mobile-slider-track-size, 2px);
  margin: 15px 0;
  background: var(--ti-mobile-slider-track-bgcolor, #ccc);
  width: ~'calc(100% - 89px)';
  display: inline-block;
  cursor: pointer;

  &.disabled {
    cursor: default;
  }

  &.disabled &__handle {
    cursor: not-allowed;
  }

  &&__vertical {
    width: var(--ti-mobile-slider-track-size, 2px);
    height: 300px;
    display: block;
    margin: 0 15px;

    & + .@{slider-prefix-cls}__input {
      margin-top: 16px;
      line-height: 1;
      transform: translateX(-50%);
    }

    .@{slider-prefix-cls}__range {
      border-radius: 10px;
      position: absolute;
      z-index: 1;
      width: var(--ti-mobile-slider-track-size, 2px);
    }

    .@{slider-prefix-cls}__up {
      top: 0;
    }

    .@{slider-prefix-cls}__down {
      bottom: 0;
    }

    .@{slider-prefix-cls}__handle {
      left: 50%;
      transform: translate(-50%, 50%);
      margin-left: 0;
    }
  }

  &__range {
    position: absolute;
    height: var(--ti-mobile-slider-track-size, 2px);
    background: var(--ti-mobile-slider-range-bgcolor, #00c696);
    z-index: 1;
  }

  &__left {
    left: 0;
  }

  &__right {
    right: 0;
  }

  &__handle {
    position: absolute;
    left: 0;
    bottom: 50%;
    transform: translateY(50%);
    width: var(--ti-mobile-slider-handle-size, 24px);
    height: var(--ti-mobile-slider-handle-size, 24px);
    border-radius: 50%;
    margin-left: -13px;
    margin-top: -13px;
    outline: none;
    background: var(--ti-mobile-slider-handle-bgcolor, #fff);
    box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.05), 0 3px 8px 0 rgba(0, 0, 0, 0.2);
    user-select: none;
    z-index: 2;
    cursor: grab;
  }

  &__tips {
    text-align: center;
    font-size: 12px;
    margin-top: -3px;
    min-width: 30px;
    position: absolute;
    padding: 0 3px;
    height: 22px;
    line-height: 183%;
    z-index: 1010;
    left: -2px;
    word-break: normal; // popup-body里面加了默认折行影响到此处需要重置
    white-space: nowrap; // 强制不换行-to liyingfu 纵向进度条上的tips如果内容过多并有空格就会掉下去，此处设置强制显示一行
    background: var(--ti-mobile-slider-tips-color, #1890ff);
    border: 1px solid var(--ti-mobile-slider-tips-color, #1890ff);
    border-radius: var(--ti-mobile-slider-tips-border-radius, 2px);
    color: var(--ti-mobile-slider-tips-text-color, #fff);

    &:before {
      margin-left: -6px;
      bottom: -6px;
      .tip-arrow(50%; auto; 0;);
      .tip-make-arrow(
        6px 6px 0 6px; var(--ti-mobile-slider-tips-color, #1890ff) transparent
      );
    }

    &:after {
      margin-left: -4px;
      bottom: -4px;
      .tip-arrow(50%; auto; 0;);
      .tip-make-arrow(
        4px 4px 0 4px; var(--ti-mobile-slider-tips-color, #1890ff) transparent
      );
    }
  }

  &__input {
    display: inline-block;
    line-height: 30px;
    vertical-align: top;
    margin-left: 16px;
    font-size: var(--ti-mobile-slider-input-font-size, 14px);
    color: var(--ti-mobile-slider-input-color, #888);

    input {
      width: 42px;
      height: 30px;
      line-height: 30px;
      border: 1px solid var(--ti-mobile-slider-input-border-color, #d9d9d9);
      border-radius: var(--ti-mobile-slider-input-border-radius, 2px);
      color: var(--ti-mobile-slider-input-color, #888);
      background: var(--ti-mobile-slider-input-bgcolor, #fff);
      font-size: inherit;
      padding: 0 8px;
      outline: 0;
      display: inline-block;
      box-sizing: border-box;
      text-align: center;
    }
  }

  &__per {
    padding-left: 8px;
  }
}
